﻿@model Products.Databases.FieldSnapshot
@{
    ViewBag.Title = "Edit " + this.Model.Name + " at" + Model.Version;
    Layout = "~/Views/Shared/App.cshtml";
    var table = (Products.Databases.Table)ViewData["Table"];
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)    
    <fieldset class="cssform">
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.SqlType)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SqlType)
            @Html.ValidationMessageFor(model => model.SqlType)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Length)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Length)
            @Html.ValidationMessageFor(model => model.Length)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Memo)
        </div>
        <div class="editor-field ckeditor">
            @Html.TextAreaFor(model => model.Memo, new { id = "MemoContent" })
            @Html.ValidationMessageFor(model => model.Memo)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.StateMemo)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.StateMemo)
            @Html.ValidationMessageFor(model => model.StateMemo)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.State)
        </div>
        <div class="editor-field">
            <label class="data">@Model.State</label>
        </div>
        <div class="editor-label">
            <label>
                Version:</label>
        </div>
        <div class="editor-field">
            <label class="data">@Model.Version</label>
        </div>
        @Html.HiddenFor(model => model.Id)
        <p>
            <input type="submit" value="Save" />
            <input type="button" value="Delete" id="DeleteSnapShot" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Details", "Table", new { table = table.Name, version = this.Model.Version }, null)
</div>
@section PageTitle{
    @String.Format("{2}->{3}->{0}({1})", this.Model.Name, this.Model.Version, table.Product.Name, table.Name)
}
@section Header{
    <script src="/ckeditor/ckeditor.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            CKEDITOR.replace('MemoContent', {
                toolbar: 'Basic',                
            });
        });
    </script>
}
